package PTA_05_29;

//修改题目125（学生类-本科生类-研究生类）
//为学生类添加属性成绩，添加相应的get和set函数，添加函数getGrade()表示获得等级，该函数应当为抽象函数。
//本科生和研究生的等级计算方式不同，如下所示
//
//本科生标准 研究生标准
//[80--100) A [90--100) A
//[70--80) B [80--90) B
//[60--70) C [70--80) C
//[50--60) D [60--70) D
//50 以下 E 60 以下 E
//
//main函数中构造两个学生Student变量，分别指向本科生和研究生对象，调用getGrade()方法输出等级
//
//输入格式:
//本科生类信息，学号、姓名、性别、专业、成绩
//研究生类信息，学号、姓名、性别、专业、导师、成绩
//
//输出格式:
//本科生等级
//研究生等级

import java.util.Scanner;

abstract class University
{
    private String StudentID;
    private String name;
    private String sex;
    private String major;
    private int grades;

    public University(String studentID, String name, String sex, String major, int grades) {
        StudentID = studentID;
        this.name = name;
        this.sex = sex;
        this.major = major;
        this.grades = grades;
    }

    public University() {
    }

    public String getStudentID() {
        return StudentID;
    }

    public void setStudentID(String studentID) {
        StudentID = studentID;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public String getMajor() {
        return major;
    }

    public void setMajor(String major) {
        this.major = major;
    }

    public int getGrades() {
        return grades;
    }

    public void setGrades(int grades) {
        this.grades = grades;
    }

    abstract void getGrade();
}

class Undergradute extends University
{
    public Undergradute(String studentID, String name, String sex, String major, int grades) {
        super(studentID, name, sex, major, grades);
    }

    public Undergradute() {
    }

    void getGrade()
    {
        int flag = this.getGrades() / 10;
        switch(flag){
            case 9:
                System.out.println("A");
                break;
            case 8:
                System.out.println("A");
                break;
            case 7:
                System.out.println("B");
                break;
            case 6:
                System.out.println("c");
                break;
            case 5:
                System.out.println("D");
                break;
            default:
                System.out.println("E");
                break;
        }
    }
}

class Postgraduate extends University
{
    private String mentor;
    public Postgraduate(String studentID, String name, String sex, String major, String mentor, int grades) {
        super(studentID, name, sex, major, grades);
        this.mentor = mentor;
    }

    public Postgraduate() {
    }

    @Override
    void getGrade() {
        int flag = this.getGrades() / 10;
        switch(flag){
            case 9:
                System.out.println("A");
                break;
            case 8:
                System.out.println("B");
                break;
            case 7:
                System.out.println("C");
                break;
            case 6:
                System.out.println("D");
                break;
            default:
                System.out.println("E");
                break;
        }
    }
}

public class Main3 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        University s1 = new Undergradute(sc.next(),sc.next(),sc.next(),sc.next(),sc.nextInt());
        University s2 = new Postgraduate(sc.next(),sc.next(),sc.next(),sc.next(),sc.next(),sc.nextInt());
        s1.getGrade();
        s2.getGrade();
    }
}
